package cn.dceast.algorithm.model;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * Created by yang_ on 2017/7/31.
 */
public class TsData {
    private String colName;
    private String minData;
    private String maxData;
    private String avgData;
    private String sumData;
    private String pdData;
    private String bzcData;


    public String getColName() {
        return colName;
    }

    public String getMinData() {
        return minData;
    }

    public String getMaxData() {
        return maxData;
    }

    public String getAvgData() {
        return avgData;
    }

    public String getSumData() {
        return sumData;
    }

    public String getPdData() {
        return pdData;
    }

    public String getBzcData() {
        return bzcData;
    }

    public void setColName(String colName) {
        this.colName = colName;
    }

    public void setMinData(String minData) {
        this.minData = testDouble(minData);
    }

    public void setMaxData(String maxData) {
        this.maxData = testDouble(maxData);
    }

    public void setAvgData(String avgData) {
        this.avgData = testDouble(avgData);
    }

    public void setSumData(String sumData) {
        this.sumData = testDouble(sumData);
    }

    public void setPdData(String pdData) {
        this.pdData = testDouble(pdData);
    }

    public void setBzcData(String bzcData) {
        this.bzcData = testDouble(bzcData);
    }
    private String testDouble(String value){
        Pattern pattern = Pattern.compile("[-\\+]?\\d+(\\.\\d+)?$");//double类型
        Matcher isNum = pattern.matcher(value);
        if( !isNum.matches() ){
            return "-";
        }
        return value;
    }
}
